<a href="<?php echo( base_url() ); ?>cmb/member_reports/download_balavihar_registered_class_roster_report/<?php echo( $urlKey ); ?>/" target="_self">Download Data</a>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );
	
	$curdatetime = time();
	
	$curdate = date('l, F jS, Y', $curdatetime);
	Form::OpenFormItemSummary('Date:', 50);
		echo( form_label($curdate, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();

	$curtime = date('h:i:s A', $curdatetime);
	Form::OpenFormItemSummary('Time:', 50);
		echo( form_label($curtime, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();

	Form::OpenFormItemSummary('School Year:', 260);
		echo( form_label($curyear.'-'.($curyear+1), 'numrecs', 'style="width: 20px;" ') );
	Form::CloseFormItem();
		
	echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');			
	Spacer::Render(0, 20);

	if (count($tginfo) > 0)
	{
		foreach($tginfo as $bvinfo)
		{			
			$bvrec = $bvinfo[0];
					
			Form::OpenFormItemSummary('Center:', 260);
				echo( form_label($bvrec['centername'], 'numrecs', 'style="width: 20px;" ') );
			Form::CloseFormItem();
			
			Form::OpenFormItemSummary('Session:', 260);
				echo( form_label($bvrec['session'], 'numrecs', 'style="width: 20px;" ') );
			Form::CloseFormItem();
			
			Form::OpenFormItemSummary('Grade:', 260);
				echo( form_label($bvrec['gradename'], 'numrecs', 'style="width: 20px;" ') );
			Form::CloseFormItem();
			
            $numreg = 0;
            $numunreg = 0;
            $numtot = 0;
            if (count($bvinfo) > 0)
            {
                foreach( $bvinfo as $bvrec)
                {            
                    if ($bvrec['fully_paid'] == "Unregistered")
                        $numunreg ++;
                    else
                        $numreg ++;
                }
                
                $numtot = $numreg + $numunreg;
            }
            
            Form::OpenFormItemSummary('Number registered students:', 260);
                echo( form_label($numreg, 'numrecs', 'style="width: 20px;" ') );
            Form::CloseFormItem();
                
            Form::OpenFormItemSummary('Number unregistered students:', 260);
                echo( form_label($numunreg, 'numrecs', 'style="width: 20px;" ') );
            Form::CloseFormItem();
                
            Form::OpenFormItemSummary('Number total students:', 260);
                echo( form_label($numtot, 'numrecs', 'style="width: 20px;" ') );
            Form::CloseFormItem();
			
			$i = 1;
			$teachers = $this->Reports_proxy->getTeachersFromGroup( $bvrec['teacher_group_id'] );
			foreach ($teachers as $tvrec)
			{
				Form::OpenFormItemSummary('Teacher'.$i.':', 260);
					echo( form_label($tvrec, 'numrecs', 'style="width: 20px;" ') );
				Form::CloseFormItem();
				
				$i ++;						
			}

			echo('<table border="1">');
			
			$i = 0;
			echo('<th><center><b>&nbspSeq#&nbsp</b></center></th>');
			echo('<th><center><b>&nbspHH_ID&nbsp</b></center></th>');
			echo('<th><center><b>&nbspFirst&nbspName&nbsp</b></center></th>');
			echo('<th><center><b>&nbspLast&nbspName&nbsp</b></center></th>');
			echo('<th><center><b>&nbspDOB&nbsp</b></center></th>');
			echo('<th><center><b>&nbspCity&nbsp</b></center></th>');
			echo('<th><center><b>&nbspState&nbsp</b></center></th>');
			echo('<th><center><b>&nbspParent&nbspName&nbsp</b></center></th>');
			echo('<th><center><b>&nbspPhone#&nbsp</b></center></th>');
			echo('<th><center><b>&nbspParent&nbspEmail&nbsp</b></center></th>');
			echo('<th><center><b>&nbspChild&nbspEmail&nbsp</b></center></th>');
			echo('<th><center><b>&nbspPay&nbspStatus&nbsp</b></center></th>');

			foreach( $bvinfo as $bvrec)
			{
				if ($i % 2 != 0)
				{
					$rowColor = "#e0ffff";
				}
				else
				{
					$rowColor = "#ffffff";
				}

				if ($bvrec['fully_paid'] == "Unregistered")
					echo('<tr bgcolor="'.$rowColor.'"><td><font color="red"><center>'.($i+1).'</center></font></td><td><center><font color="red">'.$bvrec['household_id'].'</center></font></td><td><center><font color="red">'.$bvrec['firstname'].'</center></font></td><td><center><font color="red">'.$bvrec['lastname'].'</center></font></td><td><center><font color="red">'.$bvrec['birth_date'].'</center></font></td><td><center><font color="red">'.$bvrec['city'].'</center></font></td><td><center><font color="red">'.$bvrec['state'].'</center></font></td><td><center><font color="red">'.$bvrec['parent_name'].'</center></font></td><td><center><font color="red">'.$bvrec['parent_phone'].'</center></font></td><td><center><font color="red">'.$bvrec['parent_email'].'</center></font></td><td><center><font color="red">'.$bvrec['child_email'].'</center></font></td><td><center><font color="red">'.$bvrec['fully_paid'].'</center></font></td></tr>');
				else
					echo('<tr bgcolor="'.$rowColor.'"><td><center>'.($i+1).'</center></td><td><center>'.$bvrec['household_id'].'</center></td><td><center>'.$bvrec['firstname'].'</center></td><td><center>'.$bvrec['lastname'].'</center></td><td><center>'.$bvrec['birth_date'].'</center></td><td><center>'.$bvrec['city'].'</center></td><td><center>'.$bvrec['state'].'</center></td><td><center>'.$bvrec['parent_name'].'</center></td><td><center>'.$bvrec['parent_phone'].'</center></td><td><center>'.$bvrec['parent_email'].'</center></td><td><center>'.$bvrec['child_email'].'</center></td><td><center>'.$bvrec['fully_paid'].'</center></td></tr>');
							
				$i++;
			}
					
			echo('</table>');
	
			echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');			
			Spacer::Render(0, 20);
		}
	}
	else
	{
		Form::OpenFormItemSummary('Teachers:', 260);
		Form::CloseFormItem();			
	}
?>
